package top.healthylife.gateway.platform.td.api.api.monitor;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.td.api.utils.TdUtils;
import top.healthylife.gateway.platform.td.dto.monitor.prolongmonitor.req.TdReqProlongMonitorDto;
import top.healthylife.gateway.platform.td.dto.monitor.prolongmonitor.res.TdResProlongMonitorDto;

/**
 * @author GaoZeXi
 * @date 2021/7/20 13:19
 */
@Slf4j
@Service
@ApiServiceExplain(price = 20, apiName = "延长监控", info = "个人贷中监控服务是信贷云产品面向信贷机构新增的贷中管理服务，帮助平台对已放款的借款人进行监控， 当借款人在同盾其他合作平台出现逾期记录、新增借贷或者经济法律纠纷时，同盾识别后及时通知平台，帮 助平台提早防范借款人信用恶化风险。")
public class TdProlongMonitorApi implements ParentFace<TdReqProlongMonitorDto, TdResProlongMonitorDto> {

    static String URL = "/postloan/monitor.extend/v2";
    static String REQUEST_METHOD = "POST";

    @Override
    public TdResProlongMonitorDto execute(TdReqProlongMonitorDto dto) {
        JSONObject jsonObject = TdUtils.tongDunHttpRequest(dto, URL, REQUEST_METHOD);
        return new TdResProlongMonitorDto().setSuccess(jsonObject.getBoolean(TdUtils.SUCCESS));
    }
}
